Presently, many objects that are downloaded when rendering a web page result from references to universal resource locators (URLs) are embedded within JavaScript. For example, a web page may include a table of icons that appear within a JavaScript on the page and the icons to be displayed may depend on a state, such as whether the mouse is over the icon. The icons are small objects for which prefetching is highly beneficial (i.e., it is advantageous to prefetch both copies: mouse over and mouse not over). In order to prefetch the items, the JavaScript must be parsed in order to determine the URLs for each of the icons.
Currently, JavaScript parsers maintain a complicated state machine. In order to execute the code correctly, the parser must start at the beginning of the script and adjust its state in response to each text character. In addition, the scripts may refer to other scripts and possibly on other pages, which further increases the state machine's complexity. This type of parsing is too taxing on the resources of a central processing unit (CPU) to be performed on, for example, a proxy server that is providing network acceleration for a large number of clients simultaneously. In addition, the scripts may include functions that depend on objects (e.g., cookies) or machine state (e.g., mouse position, browser configurations, etc.) that are not known to a proxy server which is remotely located. Thus, a conventional parser is both too slow and inherently unsuited to identify embedded references (among other things) for the purposes of prefetching (as well as network acceleration). Hence, there is a need for improved methods and systems in the art.